Apollo|Stateful Links 发表于 2018-03-22 | 更新于: 2019-04-28 | 分类于 技术备忘 | 阅读次数: 字数统计: 71 | 阅读时长 ≈ 1 Stateful Links某些 Link 需要在请求之间共享 state,从而完成额外的功能.Stateful links 总是重写ApolloLink 1234567891011121314import { ApolloLink } from 'apollo-link';class OperationCountLink extends ApolloLink { constructor() { super(); this.operations = 0; } request(operation, forward) { this.operations++ return forward(operation); }}const link = new OperationCountLink();